<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="../css/style2.css">
    <style>
    .notA a {
        color: #000;
    }

    /*加号*/
    .add_div {
        float: right;
        margin-right: -10px;
        margin-top: 3px;
        width: 26px;
        height: 26px;
        line-height: 26px;
        text-align: center;
        border: 1px solid #ccc;
        cursor: pointer;
        -webkit-transition: .4s all;
        transition: .4s all;
    }

    .add_div:hover {
        border: 1px solid #999;
    }

    /*小图片*/
    .img_pocket {
        height: 28px;
        cursor: pointer;
    }

    .layui-layer-btn0 {
        border-color: #20c0c7 !important;
        background-color: #20c0c7 !important;
    }

    .layui-layer-btn1,
    .layui-layer-btn2 {
        color: #333 !important;
    }

    #menu>li.container:hover {
        background-color: #ffffff;
    }

    .layui-tab>.layui-tab-title {
        overflow: hidden;
    }

    .unfold {
        width: 30px;
        height: 100%;
        background: #f5f5f5;
        position: absolute;
        top: 0px;
        right: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        transition: all 0.2s linear;
        display: none;
    }

    .unfold:hover {
        background: #dedede;
    }
    </style>
    <link rel="stylesheet" type="text/css" href="../layui/css/layui.css">
    <script src="../js/jquery.js"></script>
    <script type="text/javascript" src="../layui/layui.js"></script>
</head>

<body>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="flip-switchTC">
                <div id="FootCareTable">
                    <div>
                        <table class="layui-hide" id="FootCare_n" lay-filter="test"></table>
                    </div>
                    <div class='box box_l' style='font-weight: 600;margin-top:25px;'><i class='circle' style='background:#666;'>!</i>历史足部检查记录</div>
                    <div>
                        <table class="layui-hide" id="FootCare_f" lay-filter="test"></table>
                    </div>
                </div>
                <div id="FootCareChart">
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">
var urlS = "http://27.150.171.149:2023";
var highLowList = null;

function getHighLowList() {
    $.ajax({
        type: "get",
        async: false,
        url: urlS + "/person/inspect/all_index_range/",
        dataType: "json",
        timeout: 3000,
        success: function(data) {
            if (!data.code) {
                highLowList = data.data;
            }
        },
        error: function(err) {
            console.log(err);
        }
    });
}
// getHighLowList();

function highLow(nmber, field) {
    if (!nmber || !field) {
        return "";
    }
    var span = '<span>' + nmber + '</span>';
    if (!highLowList || !highLowList[field]) {
        return span;
    }
    if (highLowList[field].range_min > nmber) {
        span = '<span class="excessiveLow">' + nmber + '<i class="fa fa-long-arrow-down"></i></span>';
    } else if (highLowList[field].range_max < nmber) {
        span = '<span class="overtop">' + nmber + '<i class="fa fa-long-arrow-up"></i></span>';
    }
    return span;
}

function LeftFootAndRightFootF(foot) {
    if (!foot) { return ''; }
    var footArray = foot.split(','),
        footString = '';
    for (var i = 0; i < footArray.length; i++) {
        switch (footArray[i]) {
            case '0':
                footString = footString + ',左脚';
                break;
            case '1':
                footString = footString + ',右脚';
                break;
        }
    }
    return footString.substr(1);
}
</script>
<script type="text/html" id="FootCareOP"><!-- 足部护理 -->
      <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-type='del'  tabId='FootCare' url='/footexamination/{{d.id}}/' style='color:#fff;'>删除</a>
      <a class="layui-btn layui-btn-xs" lay-event="update" data-type="footCare" obj='{{JSON.stringify(d)}}' registernumber='t' tabId='FootCare' url='/footexamination/{{d.id}}/' style='color:#fff;'>修改</a>
</script>
<script type="text/html" id="FootCareDemo">
    <b style='font-weight: 600;'><i class='circle' style='background:#666;margin-top:6px;'>!</i>今日足部检查记录</b>
        <div class='add_div' data-type='footCare' ifNew='true' registernumber='t' title='新增足部检查记录'><i class="layui-icon layui-icon-add-circle"></i></div>
    </script>
<script type="text/html" id="ABI_leftTpl">
    {{ highLow(d.ABI_left,"ABI_left") }}
</script>
<script type="text/html" id="ABI_rightTpl">
    {{ highLow(d.ABI_right,"ABI_right") }}
</script>
<script type="text/html" id="PWV_leftTpl">
    {{ highLow(d.PWV_left,"PWV_left") }}
</script>
<script type="text/html" id="PWV_rightTpl">
    {{ highLow(d.PWV_right,"PWV_right") }}
</script>
<!-- 左脚and右脚显示 -->
<script type="text/html" id="vibration_senseTpl">
    {{ LeftFootAndRightFootF(d.vibration_sense) }}
</script>
<script type="text/html" id="needling_sensationTpl">
    {{ LeftFootAndRightFootF(d.needling_sensation) }}
</script>
<script type="text/html" id="foot_sensationTpl">
    {{ LeftFootAndRightFootF(d.foot_sensation) }}
</script>
<script type="text/html" id="ulcer_healingTpl">
    {{ LeftFootAndRightFootF(d.ulcer_healing) }}
</script>
<script type="text/html" id="ulcer_necrosisTpl">
    {{ LeftFootAndRightFootF(d.ulcer_necrosis) }}
</script>
<script type="text/html" id="angiogenesisTpl">
    {{ LeftFootAndRightFootF(d.angiogenesis) }}
</script>
<script type="text/html" id="peripheral_vesselsTpl">
    {{ LeftFootAndRightFootF(d.peripheral_vessels) }}
</script>
<script type="text/javascript">
$(document).ready(function() {
    layui.jquery.ajaxSetup({
        headers: { "Authorization": 'JWT ' + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNjA4NTM1NDkyLCJlbWFpbCI6IjQ2NTQ1NkBxcS5jb20ifQ.FVHlx0saZuHr-vKSlkTmWT1LZ4Mh2oEHbgnhDuizYZQ" }
    });
});

layui.use('element', function() {
    var element = layui.element;
});
layui.use('table', function() {
    var table = layui.table;
    table.render({
        elem: '#FootCare_n',
        height: 'auto',
        toolbar: '#FootCareDemo',
        url: urlS + '/footexamination/',
        where: { type: 'n', patient_id: 1106 },
        method: '',
        page: false,
        cols: [
            [
                { field: 'create_time', title: '创建日期', sort: true, width: '120', align: 'center' }, { field: 'foot_assessment', title: '足部评值', width: '120', align: 'center' }, { field: 'ABI_left', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`ABI_left`);">ABI左腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#ABI_leftTpl' }, { field: 'ABI_right', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`ABI_right`);">ABI右腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#ABI_rightTpl' }, { field: 'PWV_left', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`PWV_left`);">PWV左腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#PWV_leftTpl' }, { field: 'PWV_right', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`PWV_right`);">PWV右腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#PWV_rightTpl' }, { field: 'vibration_sense', title: '震动感觉正常', width: '100', align: 'center', templet: '#vibration_senseTpl' }, { field: 'needling_sensation', title: '针刺感觉正常', width: '100', align: 'center', templet: '#needling_sensationTpl' }, { field: 'foot_sensation', title: '足部感觉脉搏', width: '100', align: 'center', templet: '#foot_sensationTpl' }, { field: 'ulcer_healing', title: '溃疡痊愈', width: '100', align: 'center', templet: '#ulcer_healingTpl' }, { field: 'ulcer_necrosis', title: '急性溃疡坏死', width: '100', align: 'center', templet: '#ulcer_necrosisTpl' }, { field: 'angiogenesis', title: '血管绕道', width: '100', align: 'center', templet: '#angiogenesisTpl' }, { field: 'peripheral_vessels', title: '周边血管病变', width: '100', align: 'center', templet: '#peripheral_vesselsTpl' }, { field: 'other_lesions', title: '其他病变', width: '120', align: 'center' }, { title: '操作', width: '120', align: 'center', toolbar: '#FootCareOP' }
            ]
        ],
        done: function(res, curr, count) {}
    });
    table.render({
        elem: '#FootCare_f',
        height: 'auto',
        url: urlS + '/footexamination/',
        where: { type: 'f', patient_id: 1106 },
        method: '',
        page: true,
        cols: [
            [
                { field: 'create_time', title: '创建日期', sort: true, width: '120', align: 'center' }, { field: 'foot_assessment', title: '足部评值', width: '120', align: 'center' }, { field: 'ABI_left', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`ABI_left`);">ABI左腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#ABI_leftTpl' }, { field: 'ABI_right', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`ABI_right`);">ABI右腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#ABI_rightTpl' }, { field: 'PWV_left', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`PWV_left`);">PWV左腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#PWV_leftTpl' }, { field: 'PWV_right', title: '<span class="myCursorP" onclick="brokenLineF(`FootCare`,`PWV_right`);">PWV右腿 <i class="fa fa-area-chart"></i></span>', width: '120', align: 'center', templet: '#PWV_rightTpl' }, { field: 'vibration_sense', title: '震动感觉正常', width: '100', align: 'center', templet: '#vibration_senseTpl' }, { field: 'needling_sensation', title: '针刺感觉正常', width: '100', align: 'center', templet: '#needling_sensationTpl' }, { field: 'foot_sensation', title: '足部感觉脉搏', width: '100', align: 'center', templet: '#foot_sensationTpl' }, { field: 'ulcer_healing', title: '溃疡痊愈', width: '100', align: 'center', templet: '#ulcer_healingTpl' }, { field: 'ulcer_necrosis', title: '急性溃疡坏死', width: '100', align: 'center', templet: '#ulcer_necrosisTpl' }, { field: 'angiogenesis', title: '血管绕道', width: '100', align: 'center', templet: '#angiogenesisTpl' }, { field: 'peripheral_vessels', title: '周边血管病变', width: '100', align: 'center', templet: '#peripheral_vesselsTpl' }, { field: 'other_lesions', title: '其他病变', width: '120', align: 'center' }, { title: '操作', width: '120', align: 'center', toolbar: '#FootCareOP' }
            ]
        ],
        done: function(res, curr, count) {}
    });
})
</script>

</html>